import QtQuick 2.0
import Sailfish.Silica 1.0
import QtGraphicalEffects 1.0
import "../config"

//书架中的书籍块
Rectangle {
    id:root
    width: viewWidth
    height: viewHeight
    color: AppColor.themeMode.primaryComponentColor
    radius: Math.min(width,height) * 0.06

    //组件尺寸变量
    property int viewWidth: -1
    property int viewHeight: -1

    //边距
    property int padding: 20
    property int horizontalPadding: padding
    property int verticalPadding: padding

    //小说变量
    property string coverSource: "../img/img_splash.svg"
    property string novelNameValue: "斗破苍穹"


    //设置圆角
    layer.enabled: true
    layer.effect: OpacityMask {
        maskSource: Rectangle {
            width: root.width
            height: root.height
            radius: root.radius
        }
    }

    //组件详情
    Image {
        id: bookCoverImage
        source: coverSource
        anchors.fill: parent
        fillMode: Icon.PreserveAspectFit
    }


    //标题区域 
    Rectangle {
        width: parent.width
        height: titleLabel.implicitHeight + 2 * verticalPadding
        color: AppColor.themeMode.primaryComponentColor
        anchors.bottom: parent.bottom

        Label {
            id: titleLabel
            text: novelNameValue
            elide: Text.ElideRight
            color: AppColor.themeMode.primaryColor
            width: parent.width - 2 * horizontalPadding
            font.pixelSize: Theme.fontSizeTiny
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            anchors.verticalCenter: parent.verticalCenter
            anchors.horizontalCenter: parent.horizontalCenter
        }

    }

}
